package com.sv.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.stereotype.Repository;

import com.sv.model.PageInfo;
import com.sv.utils.SqlMapClientFactory;

@Repository
@Configurable(autowire = Autowire.BY_TYPE)
public class PageInfoDaoImpl implements PageInfoDao {

    @SuppressWarnings("unchecked")
    public List<Map<String, Object>> selectListRecords(PageInfo pageInfo)
            throws SQLException {
        List<Map<String, Object>> list = SqlMapClientFactory.getSqlMapClient()
                .queryForList("SQL_LIST."+pageInfo.getListSqlId(), pageInfo,
                        pageInfo.getStartRecord(), pageInfo.getPerPage());
        return list;
    }
}
